/**
*@author       wuwg
*@createTime   2018/03/20
*@updateTime   2018/03/20
*@description
*@rule
 */
@import '../../../config/config.less';
@import '../../../mixins/common/index.less';
@import "../../../mixins/input/input-mixins.less";
@import '../../../mixins/select-item/index.less';

@css-prefix-cascader: ~"@{css-prefix}cascader";
@css-prefix-cascader-item: ~"@{css-prefix}cascader-menu-item";
@css-prefix-select-dropdown: ~"@{css-prefix}select-dropdown";

.cascader-error(~"@{css-prefix-form-item}");

.@{css-prefix-cascader} {
  // input style
  .input();
  display: block; //?
  cursor: pointer;

  // wrap style
  &-wrapper {
    display: inline-block;
    width: 100%;
    vertical-align: middle;
    line-height: normal
  }

  // .aty-cascader-icon style
  &-icon {
    position: absolute;
    cursor: default;
    top: 0;
    right: 0;
    z-index: 3;
    width: @input-icon-width;
    height: @input-height-base;
    line-height: @input-height-base;
    font-size: @input-icon-font-size;
    text-align: center;
    color: @subsidiary-color;
    + .@{css-prefix-cascader} {
      padding-right: @input-icon-width-small;
    }
  }
  //  hide  .aty-cascader-icon-clear  {}
  &-icon-clear {
    z-index: 4;
    display: none;
  }

  &-icon-arrow{
    transition: all @transition-time @ease-in-out;
  }
  &-visible &-icon-arrow {
    transform: rotate(180deg);
  }
}

//  hover 时显示清除按钮，增加了show 类名，隐藏箭头，增加了类名hide
.@{css-prefix-cascader}-wrapper {
  &:hover {
    .@{css-prefix-cascader}-icon-clear.show {
      display: inline-block;
    }
    .@{css-prefix-cascader}-icon-arrow.hide {
      display: none;
    }
  }

  .@{css-prefix-select-dropdown} {
    .selectDropDown();
  }

  .select-item(@css-prefix-cascader, @css-prefix-cascader-item);

  .ivu-select-item span {
    color: @error-color;
  }

  .@{css-prefix-cascader}-dropdown {
    padding: 5px 0;

    .@{css-prefix-select-dropdown}-list {
      max-height: 190px;
      box-sizing: border-box;
      overflow: auto;
    }
  }

  .@{css-prefix-cascader}-menu {
    display: inline-block;
    min-width: 100px;
    height: 180px;
    margin: 0;
    padding: 5px 0 !important;
    vertical-align: top;
    list-style: none;
    border-right: 1px solid @border-color-split;
    overflow: auto;

    &:first-child {

    }

    &:last-child {
      border-right-color: transparent;
      margin-right: -1px;
    }

    &:only-child {

    }

    &-item {
      position: relative;
      padding-right: 24px;
      transition: all @transition-time @ease-in-out;

      i {
        font-size: @font-size-small;
        position: absolute;
        right: 15px;
        top: 50%;
        margin-top: -6px;
      }
      &-active {
        background-color: @background-color-select-hover;
        color: @primary-color;
      }
    }
  }
}

.selectDropDown{
  width: auto;
  padding: 0;
  white-space: nowrap;
  overflow: visible;
}

.@{css-prefix-cascader}-transfer{
  z-index: @zindex-transfer;
  .selectDropDown();
  .select-item(@css-prefix-cascader, @css-prefix-cascader-item);
  .ivu-select-item span{
    color: @error-color;
  }
  .@{css-prefix-cascader}-wrapper {
    .@{css-prefix-cascader}-menu{
      &-item{
        padding-right: 24px;
        transition: all @transition-time @ease-in-out;
        &-active{
          background-color: @background-color-select-hover;
          color: @primary-color;
        }
      }
    }
  }
}

// 出错提示样式
.cascader-error(@class){
  .@{class}-error{
    .@{css-prefix-cascader} {
      .input-error();
      &-icon {
        color: @error-color;
      }
    }
  }
}
